package component;
/**
 * 结果信息
 * @author yanghao
 * 2015年6月4日 下午3:59:58
 */
public class ErrorInfo {
	/**
	 * 成功
	 */
	public static final int SUCCESS = 1;
	/**
	 * 失败
	 */
	public static final int FAILURE = -1;
	
	
	public static final String SYSTEM_ERROR = "对不起，系统异常，请稍候再试";
	
	/**
	 * 信息代码
	 */
	private int error;
	/**
	 * 信息内容
	 */
	private String msg;
	
	public ErrorInfo(){
		this.error = SUCCESS;
		this.msg = "";
	}
	/**
	 * 封装错误信息
	 * @param msg 需要封装的错误信息
	 */
	public ErrorInfo(String msg){
		this.error = FAILURE;
		this.msg = msg;
	}
	
	public void clear(){
		this.error = 1;
		this.msg = "";
	}
	
	public ErrorInfo(int error, String msg) {
		this.error = error;
		this.msg = msg;
	}
	public int getError() {
		return error;
	}
	public void setError(int error) {
		this.error = error;
	}
	public String getMsg() {
		return msg;
	}
	public void setMsg(String msg) {
		this.msg = msg;
	}
	
	public boolean isSuccess(){
		if(this.error==SUCCESS){
			return true;
		}else{
			return false;
		}
	}
}
